package com.pw.study.del;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class DelDir {
    public static void deletePath(Job job) throws IOException {
        System.out.println("上帝模式已开启.................................");
        FileSystem fs = FileSystem.get(job.getConfiguration());
        Path path = FileOutputFormat.getOutputPath(job);
        if(fs.exists(path)){
            System.out.println("******删除路径***************************"+path);
            fs.delete(path,true);
        }
    }
}
